<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var a = prompt('请输入字符');
    a = parseInt(a);
    console.log(a);
    if (isNaN(a)){
        alert('对不起，您输入的内容有误')
    }
    var r = a*a;
    console.log(r);
</script>
</body>
</html>